<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form"  %>
<div class="content-header">
	<h1>产品类型</h1>
</div>
<div class="content">
	<div class="box">
	<div class="box-body">
		<table id="example2" class="table table-bordered table-hover">
			<thead>
				<tr>
					<th>产品名称</th>
					<th>借款管理费</th>
					<th>操作</th>
				</tr>
			</thead>
			<c:forEach items="${borrowProducts }" var="obj">
			<tr>
				<td>${obj.name }</td>
				<td>${obj.managementFeeRatio }</td>
				<td>
					<a href="">编辑</a>
					<a href="">删除</a>
				</td>
			</tr>
			</c:forEach>
		</table>
	</div>
	</div>
</div>
<div class="modal modal-info" id="model-primary">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h4 class="modal-title">Tile</h4>
			</div>
			<sf:form servletRelativeAction="/admin/borrow/add_product" method="post" modelAttribute="borrowProduct">
			<div class="modal-body">
				<div class="form-group">
					<label>产品名称:</label>
					<sf:input path="name" cssClass="form-control"/>
				</div>
				<div class="form-group">
					<label>借款管理费：</label>
					<sf:input path="managementFeeRatio" cssClass="form-control" placeholder="0.05"/>
				</div>
				<div class="form-group">
					<label>额度范围:</label>
					<input class="form-control" placeholder="10-60">
				</div>
				<div class="form-group">
					<label>期限范围：</label>
					<input class="form-control" placeholder="6、12、18、24">
				</div>
				<div class="form-group">
					<label>区域限制:</label>
					<input class="form-control" placeholder="深圳">
				</div>
				<div class="form-group">
					<label>产品说明：</label>
					<textarea rows="6" cols="6" class="form-control"></textarea>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button>
				<button type="submit" class="btn btn-outline">Save</button>
			</div>
			</sf:form>
		</div>
	</div>

</div>
<script type="text/javascript">
	$(document).ready(function(){
		$("#example2").DataTable({
			'paging':true,
			'dom':'Bfrtip',
			'buttons':[
				{
					'text':'create',
					'action':function(e,dt,node,config){
						$("#model-primary").modal('show');
					}
				}
			]
		});
		$("div.toolbar").html('<a href="">创建</a>');
	});
	
</script>